package zzz.javademo;

import java.sql.*;

/**
 * Created by 隼 on 2016/12/9.
 */
public class php3 {
    public static void main(String[] args) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection com= DriverManager.getConnection("jdbc:mysql://localhost:3306/phpcms", "root", "");
            Connection comt= DriverManager.getConnection("jdbc:mysql://localhost:3306/phpcms", "root", "");
            //获取传输器对象
            Statement statement=com.createStatement();
            Statement stat=comt.createStatement();

            ResultSet rs=statement.executeQuery("SELECT url FROM v9_category  ");
            String str;
            while(rs.next()){
                str=rs.getString("url");
                if(str.indexOf("http://210.30.208.142")!=-1){
                    String  str1= str.replaceAll("http://210.30.208.142","http://58.154.51.95");
                    System.out.println("UPDATE v9_category SET url='"+str1+"' where url='"+str+"'");

                   stat.executeUpdate("UPDATE v9_category SET url='"+str1+"' where url='"+str+"'");
               // System.out.println(str);
                }
               // System.out.println(str);
            }

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }

        //获取数据库连接



    }
}
